﻿<inter:PluginConfigForm x:Class="Convertor.Plugin.StopCondition.ConfigForm"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:sm="clr-namespace:Wpf.CommonTools.SystemExtension;assembly=Wpf.CommonTools"
             xmlns:conv="clr-namespace:Wpf.CommonTools.Converter;assembly=Wpf.CommonTools"
             xmlns:inter="clr-namespace:Convertor.Interface;assembly=Convertor.Interface"
             xmlns:local="clr-namespace:Convertor.Plugin.StopCondition"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d" 
             MinWidth="300">
    <inter:PluginConfigForm.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Convertor;component\Assets\Style.xaml"/>
                <ResourceDictionary Source="/Convertor;component\Assets\Lang\StringResource.en.xaml"/>
                <ResourceDictionary Source="Assets\Lang\StringResource.zh.xaml"/>
                <ResourceDictionary Source="Assets\Lang\StringResource.en.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <ObjectDataProvider x:Key="ConditionOptions" 
                        MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
                <ObjectDataProvider.MethodParameters>
                    <x:Type TypeName="local:ConditionOptions"/>
                </ObjectDataProvider.MethodParameters>
            </ObjectDataProvider>
            <ObjectDataProvider x:Key="OutputTypes" 
                        MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
                <ObjectDataProvider.MethodParameters>
                    <x:Type TypeName="inter:OutputTypes"/>
                </ObjectDataProvider.MethodParameters>
            </ObjectDataProvider>
            <conv:FindUILanguageConverter x:Key="FindUILanguageConverter"/>
            <conv:MultiStringFormatConverter x:Key="MultiStringFormatConverter"/>
            <conv:EnumToVsibleConverter x:Key="EnumToVsibleConverter"/>
        </ResourceDictionary>
    </inter:PluginConfigForm.Resources>
    <DockPanel DataContext="{Binding RelativeSource={RelativeSource AncestorType=inter:PluginConfigForm, Mode=FindAncestor}, Path=Config}">
        <AdornerDecorator DockPanel.Dock="Top">
            <ComboBox x:Name="cbTarget"
                  SelectedValue="{Binding Path=CompareTarget}"
                  ItemsSource="{Binding Source={StaticResource OutputTypes}}" >
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Path=., Converter={StaticResource FindUILanguageConverter}, ConverterParameter=''}"/>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
                <sm:WatermarkService.Titlemark>
                    <TextBlock Text="{DynamicResource Plugin_StopCondition_CompareTarget}" TextAlignment="Right" VerticalAlignment="Bottom"></TextBlock>
                </sm:WatermarkService.Titlemark>
            </ComboBox>
        </AdornerDecorator>
        <AdornerDecorator  DockPanel.Dock="Top">
            <ComboBox x:Name="cbCondition"
                  SelectedItem="{Binding Path=Condition}"
                  ItemsSource="{Binding Source={StaticResource ConditionOptions}}" >
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Path=., Converter={StaticResource FindUILanguageConverter}, ConverterParameter='Plugin_StopCondition_ConditionOption_'}"/>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
                <sm:WatermarkService.Titlemark>
                    <TextBlock Text="{DynamicResource Plugin_StopCondition_ConditionOptions}" TextAlignment="Right" VerticalAlignment="Bottom"></TextBlock>
                </sm:WatermarkService.Titlemark>
            </ComboBox>
        </AdornerDecorator>
        <TextBlock Style="{StaticResource InfoStyle}" DockPanel.Dock="Top" Text="{Binding Path=ToolTip}"/>
    </DockPanel>
</inter:PluginConfigForm>
